<!DOCTYPE HTML>
<html  xmlns:th="http://www.thymeleaf.org">
<head th:include="_meta :: header">
    <title>申请</title>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form form form-horizontal"  id="form-equapply-add" action="#" th:action="@{/equipment/equipment/applys}">
<!--            <div class="layui-form-item">-->
<!--                <label class="layui-form-label"><span class="x-red">*</span>申请编号：</label>-->
<!--                <div class="layui-input-inline">-->
<!--                    <input type="layui-input" class="layui-input" t name="applyId"  placeholder="修改申请编号" id="applyId"/>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <label class="layui-form-label"><span-->
<!--                        class="c-red">*</span>设备编号：</label>-->
<!--                <div class="layui-input-inline">-->
<!--                    <input type="text" class="layui-input" readonly="readonly"-->
<!--                           th:value="${equipment.equId}"-->
<!--                           name="equId" placeholder="修改设备编号"-->
<!--                           id="equId"/>-->

<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <label class="layui-form-label"><span class="x-red">*</span>设备名称：</label>-->
<!--                <div class="layui-input-inline">-->
<!--                    <input type="layui-input" class="layui-input" t name="equName"  placeholder="修改设备名称" id="equName"/>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <label class="layui-form-label"><span class="x-red">*</span>设备类型：</label>-->
<!--                <div class="layui-input-inline">-->
<!--                    <input type="layui-input" class="layui-input" t name="equType"  placeholder="修改设备类型" id="equType"/>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <label class="layui-form-label"><span class="c-red">*</span>申请人id：</label>-->
<!--                <div class="layui-input-inline">-->
<!--                    <input type="layui-input" class="layui-input"-->
<!--                           th:value="${account}"-->
<!--                           name="applyPersonid" placeholder="修改申请人id"-->
<!--                           id="applyPersonid"/>-->

<!--                </div>-->
<!--            </div>-->

<!--            <div class="layui-form-item">-->
<!--                <label class="layui-form-label"><span class="x-red">*</span>申请状态（1.同意2.驳回）：</label>-->
<!--                <div class="layui-input-inline">-->
<!--                    <input type="layui-input" class="layui-input" t name="applyStatus"  placeholder="修改申请状态（1.同意2.驳回）" id="applyStatus"/>-->
<!--                </div>-->
<!--            </div>-->
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>申请原因：</label>
                <div class="layui-input-inline">
                    <input type="layui-input" class="layui-input" t name="applyReason"  placeholder="修改申请原因" id="applyReason"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>设备申请时间：</label>
                <div class="layui-input-inline">
                    <input type="layui-input" class="layui-input timeSpace" readonly="readonly"
                           autocomplete="off" name="applyCreatetime" placeholder="请选择设备申请时间"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>预计归还时间：</label>
                <div class="layui-input-inline">
                    <input type="layui-input" class="layui-input timeSpace" readonly="readonly"
                           autocomplete="off" name="applyUpdatetime" placeholder="请选择预计归还时间"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="x-red">*</span>备注：</label>
                <div class="layui-input-inline">
                    <input type="layui-input" class="layui-input" t name="applyRemake"  placeholder="修改备注" id="applyRemake"/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                </label>
                <button  class="layui-btn" id="subbtn" type="submit" >
                    申请
                </button>
                <button  class="layui-btn" id="reset" type="reset" >
                    重置
                </button>
            </div>
        </form>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs"></div>
<div th:replace="_ueditor :: ueditor"></div>
<!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script>
    layui.use(['form', 'layer','laydate'],function() {
        $ = layui.jquery;
        var form = layui.form,
            laydate = layui.laydate,
            layer = layui.layer;
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,trigger: 'click'
                ,type: 'datetime'
            });
        });
    });
    $(function(){
        $("#form-equapply-add").validate({
            rules:{
                applyId:{
                    required: true,
                },
                equId:{
                    required: true,
                },
                equName:{
                    required: true,
                },
                equType:{
                    required: true,
                },
                applyPersonid:{
                    required: true,
                },
                applyReason:{
                    required: true,
                },
            },
            onkeyup:false,
            debug: true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    type: 'POST',
                    url: "/equipment/equipment/applys" ,
                    success: function(data){
                        if(data.code == "1"){
                            selfmsg('添加成功!',1,function(){
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.location.reload();
                                parent.layer.close(index);
                            });
                        }else{
                            selfmsg('添加失败!');
                        }
                    },
                    error: function(){
                        selfmsg('添加异常!',5);
                    }
                });
            }
        });
    });

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>